import Vue from 'vue';
import Router from 'vue-router';

Vue.use(Router);

// 公共路由
export const constantRoutes = [
    {
        path: '/login',
        component: () => import(/* webpackChunkName: "login" */ '../components/page/Login.vue'),
        meta: { title: '登录' }
    }
    //,
    // {
    //     path: '*',
    //     redirect: '/404'
    // },
    // {
    //     path: '/404',
    //     component: () => import(/* webpackChunkName: "404" */ '../components/page/404.vue'),
    //     meta: { title: '404' }
    // }
]

// 动态路由，基于用户权限动态去加载
export const dynamicRoutes = [
    {
        path: '/',
        component: () => import(/* webpackChunkName: "home" */ '../components/common/Home.vue'),
        meta: { title: '自述文件' },
        children: [
            {
                path: '/404',
                component: () => import(/* webpackChunkName: "404" */ '../components/page/404.vue'),
                meta: { title: '404' }
            },
            {
                path: '/403',
                component: () => import(/* webpackChunkName: "403" */ '../components/page/403.vue'),
                meta: { title: '403' }
            },{
                path: '/authRole/:userId(\\d+)',
                component: () => import(/* webpackChunkName: "donate" */ '../components/system/authRole.vue'),
                meta: { title: '用户管理' }
            },{
                path: '/dictData/:dictId(\\d+)',
                component: () => import('../components/system/dictData.vue'),
                name: 'Data',
                meta: { title: '字典数据', activeMenu: '/system/dict' }
            },{
                path: '/user/profile',
                component: () => import('../components/system/user/profile/index'),
                name: 'profile',
                meta: { title: '个人中心', activeMenu: '/user/profile' }
            }
        ]
    }
]

export default new Router({
    routes: constantRoutes
})

